/*
 * @Description: 请输入....
 * @Author: Gavin
 * @Date: 2022-01-11 15:24:49
 * @LastEditTime: 2022-06-21 18:34:34
 * @LastEditors: Gavin
 */
const test = [
    ["000001", "陈晓鹏", "技术部"],
    ["000002", "薛涛骏", "技术部"],
    ["000003", "高晶晶", "技术部"],
    ["000004", "李莹", "技术部"],
    ["000005", "孙小蕾", "技术部"],
    ["000006", "庞文峻", "技术部"],
    ["000007", "高馨晨", "技术部"],
    ["000008", "武赛", "技术部"],
    ["000009", "刘梦瑶", "技术部"],
    ["000010", "李岩(小)", "技术部"],
    ["000011", "靳虎安", "技术部"],
    ["000012", "王庆伟", "技术部"],
    ["000013", "魏雪梅", "技术部"],
    ["000014", "胡阳", "技术部"],
    ["000015", "胡福来", "技术部"],
    ["000016", "史鹏", "技术部"],
    ["000017", "吴咸鑫", "技术部"],
    ["000018", "刘智阳", "技术部"],
    ["000019", "郭惠文", "技术部"],
    ["000020", "罗会强", "技术部"],
    ["000021", "崔世强", "技术部"],
    ["000022", "徐仲景", "技术部"],
    ["000023", "张璇", "技术部"],
    ["000024", "李岩(大)", "技术部"],
    ["000025", "达星星", "技术部"],
    ["000026", "姚辛壁", "技术部"],
    ["000027", "杨晓婷", "技术部"],
    ["000028", "张然", "技术部"],
    ["000029", "胡玲玲", "技术部"],
    ["000030", "龚显", "技术部"],
    ["000031", "胡慧芹", "技术部"],
    ["000032", "韩荣军", "技术部"],
    ["000033", "国丽", "技术部"],
    ["000034", "朱文娟", "技术部"],
    ["000035", "尹梓炎", "技术部"],
    ["000036", "赵欢", "技术部"],
    ["000037", "于会杰", "技术部"],
    ["000038", "孙艳艳", "技术部"],
    ["000039", "王娜", "技术部"],
    ["000040", "段伦凯", "技术部"],
    ["000041", "程晓杰", "技术部"],
    ["000042", "程珊珊", "技术部"],
    ["000043", "苏勇", "技术部"],
    ["000044", "褚洪丽", "技术部"],
    ["000045", "田宇", "技术部"],
    ["000046", "严佳杰", "技术部"],
    ["000047", "史尚超", "技术部"],
    ["000048", "李响", "技术部"]]

// const test = [["000001", "陈晓鹏", "技术部"], ["000002", "薛涛骏", "技术部"]]

function randomsort(a, b) {
    return Math.random() > .5 ? -1 : 1;
    //用Math.random()函数生成0~1之间的随机数与0.5比较，返回-1或1
}

const getUrlParams = (paramName) => {
    // 获取当前页面的 URL
    const url = new URL(window.location.href);
    const searchParams = url.searchParams;

    // 获取指定参数的值
    const paramValue = searchParams.get(paramName);
    return paramValue
}


const user = test.sort(randomsort)
/**
 * 卡片公司名称标识
 */
const COMPANY = "六一六";
/**
 * 奖品设置
 * type: 唯一标识，0是默认特别奖的占位符，其它奖品不可使用
 * count: 奖品数量
 * title: 奖品描述
 * text: 奖品标题
 * img: 图片地址
 * ROTATE_TIME:转的球速度越大越慢
 * circle:旋转圈数最好8*x倍数
 * enter: //抽奖进行时音乐
 * awards: //颁奖音乐
 */
let prizes = [{
    type: 0, count: 1000, title: "抽奖结束", text: "需要重新抽奖请配置后重置"
}, {
    type: 1, count: 1, text: "特等奖", title: "(平板)", img: "./img/pid.png", enter: "bg4",//抽奖进行时音乐
    awards: "1st-BJ-BGM",//颁奖音乐
    ROTATE_TIME: 20000, circle: 8 * 6
}, {
    type: 2, count: 1, text: "一等奖", title: "(相机)", img: "./img/2.png", enter: "bg3",//抽奖进行时音乐
    awards: "other-BJ-BGM",//颁奖音乐
    ROTATE_TIME: 20000, circle: 8 * 3
}, {
    type: 3, count: 2, text: "二等奖", title: "(咖啡机)", img: "./img/3.png", enter: "bg3",//抽奖进行时音乐
    awards: "other-BJ-BGM",//颁奖音乐
    ROTATE_TIME: 10000, circle: 8 * 3
}, {
    type: 4, count: 3, text: "三等奖", title: "(破壁机)", img: "./img/4.png", enter: "bg3",//抽奖进行时音乐
    awards: "other-BJ-BGM",//颁奖音乐
    ROTATE_TIME: 10000, circle: 8 * 3
}];
const pageType = getUrlParams('type');
if (pageType == 'add') {
    prizes = [{
        type: 0, count: 1000, title: "抽奖结束", text: "需要重新抽奖请配置后重置"
    }, {
        type: 5, count: 10, text: "神秘大奖", title: "", img: "./img/5.png", enter: "bg5",//抽奖进行时音乐
        awards: "1st-BJ-BGM",//颁奖音乐
        ROTATE_TIME: 20000, circle: 8 * 2
    },]
}

let prizeLocal = localStorage.getItem('prizeLocal')
let prizeLocalAdd = localStorage.getItem('prizeLocalAdd')
if (prizeLocal) {
    let prizeLocalData = JSON.parse(prizeLocal);
    // 神秘大奖个数为999
    if (prizes[1]) {
        prizes[1].count = prizeLocalData[0];
    }
    if (prizes[2]) {
        prizes[2].count = prizeLocalData[1];
    }
    if (prizes[3]) {
        prizes[3].count = prizeLocalData[2];
    }
    if (prizes[4]) {
        prizes[4].count = prizeLocalData[3];
    }
}
if (prizeLocalAdd) {
    let prizeLocalAddData = JSON.parse(prizeLocalAdd);
    const pageType = getUrlParams('type');
    if (pageType == 'add') {
        if (prizes[1]) {
            prizes[1].count = prizeLocalAddData[0];
        }
    }
}


let luckyData = JSON.parse(localStorage.getItem("luckyData")) || {};

let leftUsers = JSON.parse(localStorage.getItem("leftUsers")) || user;

let awardList = JSON.parse(localStorage.getItem("awardList")) || {}


//不能说的秘密
const excludeUser = [["000005", "张无忌", "技术部"]]

/**
 * @description: 不能说的秘密
 * @param {*} nowItem 当前奖品
 * @param {*} basicData 当前奖池人员
 * @return {*}
 * @Date: 2022-01-13 15:13:31
 */
function setSecret(nowItem, basicData) {
    if (nowItem.type != 4) {
        // console.log(mockData.excludeUser);
        // const excludeId = excludeUser.map(item => item[0])
        // console.log(excludeId, basicData.leftUsers);
        // basicData.leftUsers = basicData.leftUsers.filter(human => !excludeId.includes(human[0]))
        // console.log('leftUsers--?',basicData.leftUsers);
    }
}

//颜色
const rgba = "0,0,0"
//透明度
const opacity = () => 0.3 || Math.random() * 0.7 + 0.25
//气氛组卡片
const atmosphereGroupCard = () => `rgba(${rgba},${opacity()})`
//背景色
const background = "url(https://sixos.oss-cn-beijing.aliyuncs.com/profile/upload/2024/12/19/bdf82d15083346d3996e8f3e538b8164.png)"
//背景动态壁纸模式 不用时可以设置为null或者注释
// const bgVideo="//game.gtimg.cn/images/lol/act/a20220121lunarpass/bg.mp4"
const width = window.innerWidth * .75
const height = window.innerWidth * .75 * .75
/**
 * 一次抽取的奖品个数与prizes对应
 */
const EACH_COUNT = [1, 1, 1, 1, 1];
export default {
    EACH_COUNT,
    prizes,
    COMPANY,
    user,
    luckyData,
    leftUsers,
    awardList,
    excludeUser,
    atmosphereGroupCard,
    background,
    setSecret,
    width,
    height,
    bgVideo
}
